/**
 * Created with JetBrains PhpStorm.
 * User: Administrator
 * Date: 14-12-1
 * Time: 下午4:05
 * To change this template use File | Settings | File Templates.
 */
$(function(){
    //选择
    $('.J_checkitem').live('click',function(){
        var parent = $(this).parent().parent();
        var pid    = parent.attr('id');
        var find   = "tr.child-of-"+pid;
        var child  = $(find);
        var checked = $(this).get(0).checked;
        child.each(function(){
            getChildMenu(child,checked);
        });
    });
});
function getChildMenu(o,c){
    o.each(function(){
        var pid = $(this).attr('id');
        var find   = "tr.child-of-"+pid;
        var child  = $(find);
        $(this).children().find('.J_checkitem').get(0).checked=c;
        if(child.length>0){
            getChildMenu(child,c);
        }
    });
}
